from librpg.util import IdFactory

facility_factory = IdFactory()

class Facility(object):

    id = None
    'Unique id'
    
    name = 'Facility'
    'Facility name as it should be displayed.'
    
    building_time = 0
    'How many days it takes to build the facility.'

    effect = ''
    'Description of the facility effect.'
    
    cumulative = False
    'Whether several of these facilities may be built in the same dojo.'

class TrainingRoom1(Facility):
    id = 'training room 1'
    name = 'Training Room'
    building_time = 3
    effect = 'Decreases the time to teach a skill at home dojo.'
facility_factory.register(TrainingRoom1)

class TrainingRoom2(Facility):
    id = 'training room 2'
    name = 'Training Chamber'
    building_time = 7
    effect = TrainingRoom1.effect
facility_factory.register(TrainingRoom2)

class TrainingRoom3(Facility):
    id = 'training room 3'
    name = 'Training Dimension'
    building_time = 21
    effect = TrainingRoom1.effect
facility_factory.register(TrainingRoom3)

class Dormitories(Facility):
    id = 'dormitories'
    name = 'Dormitories'
    building_time = 4
    cumulative = True
    effect = 'Increases the total unit capacity for the dojo - including '\
             'travelling and stationary groups.'
facility_factory.register(Dormitories)

class Library(Facility):
    id = 'library'
    name = 'Library'
    building_time = 2
    cumulative = True
    effect = 'Stores tip books, dungeon maps and skill scrolls.'
facility_factory.register(Library)
    
class Classrooms(Facility):
    id = 'classrooms'
    name = 'Classrooms'
    building_time = 3
    cumulative = True
    effect = 'Allows offering skill teaching as a means to earn money.'
facility_factory.register(Classrooms)
    
class RecreationRoom1(Facility):
    id = 'recreation room 1'
    name = 'Gaming Room'
    building_time = 2
    effect = 'Increases the new candidate event ratio.'
facility_factory.register(RecreationRoom1)

class RecreationRoom2(Facility):
    id = 'recreation room 2'
    name = 'Casino'
    building_time = 10
    effect = RecreationRoom1.effect
facility_factory.register(RecreationRoom2)

class RecreationRoom3(Facility):
    id = 'recreation room 3'
    name = 'Entertainment Wing'
    building_time = 28
    effect = RecreationRoom1.effect
facility_factory.register(RecreationRoom3)

class TrophyRoom(Facility):
    id = 'trophy room'
    name = 'Trophy Room'
    building_time = 7
    effect = 'Displays medals and trophies earned in tournaments.'
facility_factory.register(TrophyRoom)

_ATTRIBUTE_ROOMS_EFFECT = 'Permanently Boosts the %s of units left there by '\
                          'a small amount.'

class StrengthAttributeRoom(Facility):
    id = 'strength attribute room'
    name = 'Fitness Room'
    building_time = 10
    effect = _ATTRIBUTE_ROOMS_EFFECT % 'strength'
facility_factory.register(StrengthAttributeRoom)

class ConstitutionAttributeRoom(Facility):
    id = 'constitution attribute room'
    name = '???'
    building_time = 10
    effect = _ATTRIBUTE_ROOMS_EFFECT % 'constitution'
facility_factory.register(ConstitutionAttributeRoom)

class DexterityAttributeRoom(Facility):
    id = 'dexterity attribute room'
    name = 'Gym'
    building_time = 10
    effect = _ATTRIBUTE_ROOMS_EFFECT % 'dexterity'
facility_factory.register(DexterityAttributeRoom)

class MindAttributeRoom(Facility):
    id = 'mind attribute room'
    name = 'Study Room'
    building_time = 10
    effect = _ATTRIBUTE_ROOMS_EFFECT % 'mind'
facility_factory.register(MindAttributeRoom)

class SpiritAttributeRoom(Facility):
    id = 'spirit attribute room'
    name = 'Meditation Chamber'
    building_time = 10
    effect = _ATTRIBUTE_ROOMS_EFFECT % 'spirit'
facility_factory.register(SpiritAttributeRoom)
